package com.tengroup.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tengroup.dao.WrongQuestionDao;
import com.tengroup.entity.WrongQuestionEntity;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WrongQuestionServiceimpl extends ServiceImpl<WrongQuestionDao, WrongQuestionEntity> implements WrongQuestionService {

    @Override
    public List<WrongQuestionEntity> generateTrainingPaper(String difficulty, Integer courseId) {
        // 使用 MyBatis-Plus 的 lambdaQuery 方法进行查询
        return this.lambdaQuery()
                .eq(WrongQuestionEntity::getDifficulty, difficulty) // 根据难易程度筛选
                .eq(WrongQuestionEntity::getCourseId, courseId)     // 根据科目ID筛选
                .eq(WrongQuestionEntity::getDelFlag, false)         // 过滤已删除的错题
                .list();
    }
}